//
// main.cpp for 202loi in /home/morel_t//Rendu/maths/202loi
//
// Made by thomas morel
// Login   <morel_t@epitech.net>
//
// Started on  Tue Mar  6 17:10:23 2012 thomas morel
// Last update Fri Mar  9 16:57:23 2012 florian jousseau
//

#include "202loi.h"
#include "Table.hh"

static void	header(std::string **tab)
{
  for (int x = 1; x <= 5; x++)
    {
      tab[0][x] = "X = ";
      tab[0][x] += toStringHeader(x);
    }
  tab[0][6] = "Loi de Y";

  for (int y = 1; y <= 5; y++)
    {
      tab[y][0] = "Y = ";
      tab[y][0] += toStringHeader(y);
    }
  tab[6][0] = "Loi de X";
}

void		option_1(t_tab *tab)
{
  tab->tab1 = new Table(7, 7);
  header(tab->tab1->getSTab());
  for (int y = 1; y <= 5; y++)
    {
      for (int x = 1; x <= 5; x++)
	tab->tab1->getSTab()[y][x] = toString(loi_conjointe(x, y));
      ;
    }
  for (int pos = 1; pos <= 5; pos++)
    {
      tab->tab1->getSTab()[pos][6] = toString(loi_marginale_y(tab->tab1->getSTab(), pos));
      tab->tab1->getSTab()[6][pos] = toString(loi_marginale_x(tab->tab1->getSTab(), pos));
    }
  tab->tab1->getSTab()[6][6] = toString(1);
  // tab->tab1->printTab();
}
